home *** CD-ROM | disk | FTP | other *** search
/ HamCall (April 1991) / HAMCALL CD-ROM (Buckmaster)(April 1991).BIN / telcom / qmodem / down.scr < prev    next >
Text File  |  1989-02-20  |  15KB  |  523 lines

  1. ;*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*;
  2. ;                                                           ;
  3. ;   Script DOWN.SCR    (C) The Forbin Project               ;
  4. ;                                                           ;
  5. ;   Multi-File Download Script for the Forbin Project       ;
  6. ;   PCBoard Bulletin Board (and compatible PCBoard systems  ;
  7. ;                                                           ;
  8. ;*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*;
  9.  
  10. TURNOFF NOISE MUSIC
  11.  
  12. STRING  XFER TMP1 TC TR BC BR BOTSET TOPSET CMD1 RC FNUM SATTR
  13.  
  14. ASSIGN  TC 1        ; Screen window position variables.
  15. ASSIGN  TR 1        ;   Initialize all to 1
  16. ASSIGN  BC 1        ;   ...
  17. ASSIGN  BR 1        ;   ...
  18.  
  19. GOTO    START.001   ; Branch around the subroutines defined.
  20.  
  21.  
  22.         ;---------------------------------------------------------;
  23.         ;  Subroutine GetFileName                                 ;
  24.         ;                                                         ;
  25.         ;  Uses variable RC as a return code                      ;
  26.         ;                                                         ;
  27.         ;     If a filename is entered, RC is set to 1            ;
  28.         ;     If no filename is entered, RC is set to 0           ;
  29.         ;                                                         ;
  30.         ;  $FNUM is passed in and the valid filenames are stored  ;
  31.         ;  in  $FNUM's pointer variable.  IE, if $FNUM = 2, then  ;
  32.         ;  $2 contains the valid filename.                        ;
  33.         ;                                                         ;
  34.         ;---------------------------------------------------------;
  35.         GetFileName:
  36.         ASSIGN  RC 0                        ; set RC to unsuccessful
  37.         COLOR   2                           ; set a green color
  38.         INCR    FNUM                        ; inc FNUM
  39.         DISPLAY "File # $FNUM > "           ; prompt for filename # FNUM
  40.         DECR    FNUM                        ; dec FNUM back again
  41.         COLOR   3                           ; set a cyan color
  42.         GET     TMP1 12                     ; read filename in to $TMP1
  43.         IF      "$TMP1" = "" GO1            ; if not good, goto GO1 label
  44.         ASSIGN  CMD1 "ASSIGN $FNUM $TMP1"   ; set up a variable CMD1
  45.         $CMD1                               ; now execute it! (a neat trick)
  46.         ASSIGN  RC 1                        ; set RC to successful
  47.         GO1:                                ; the branch around label GO1
  48.         RETURN                              ; return to calling GOSUB
  49.  
  50.  
  51.         ;---------------------------------------------------------;
  52.         ;  Subroutine Set_Top                                     ;
  53.         ;                                                         ;
  54.         ;  Sets the cursor in the top window ifnot already there. ;
  55.         ;  If it needs to be moved, the bottom window cursor      ;
  56.         ;  position is saved before the move.                     ;
  57.         ;                                                         ;
  58.         ;---------------------------------------------------------;
  59.         Set_Top:
  60.         IF      TOPSET = TRUE STR
  61.         ASSIGN  BC $WHEREX
  62.         ASSIGN  BR $WHEREY
  63.         WINDOW  1,1,80,14
  64.         GOTOXY  $TC,$TR
  65.         ASSIGN  TOPSET TRUE
  66.         ASSIGN  BOTSET FALSE
  67.         STR:
  68.         RETURN
  69.  
  70.  
  71.         ;---------------------------------------------------------;
  72.         ;  Subroutine Set_Bottom                                  ;
  73.         ;                                                         ;
  74.         ;  Sets the cursor in the bottom window if not already    ;
  75.         ;  there.  If it needs to be moved, the top window cursor ;
  76.         ;  position is saved before the move.                     ;
  77.         ;                                                         ;
  78.         ;---------------------------------------------------------;
  79.         Set_Bottom:
  80.         COLOR   7
  81.         IF      BOTSET = TRUE SBR
  82.         ASSIGN  TC $WHEREX
  83.         ASSIGN  TR $WHEREY
  84.         WINDOW  1,15,80,$LAST_ROW
  85.         GOTOXY  $BC,$BR
  86.         ASSIGN  BOTSET TRUE
  87.         ASSIGN  TOPSET FALSE
  88.         SBR:
  89.         RETURN
  90.  
  91.    
  92. ;---------------------------------------------------------;
  93. ;  Start of Script DOWN.SCR                               ;
  94. ;---------------------------------------------------------;
  95. START.001:
  96.  
  97. GETSCR                          ; save the screen
  98. ASSIGN    SATTR $ATTR           ; and the original colors
  99. COLOR     12
  100. BOX       38 1 80 8             ; draw a box
  101. COLOR     14
  102. CLRSCR                          ; clear the box and display instructions
  103. DISPLAYLN " Multi-File Download for PCBoard!"
  104. COLOR     15
  105. DISPLAYLN " "
  106. DISPLAYLN " Instructions:"
  107. COLOR     6
  108. DISPLAYLN " Enter a filename after each prompt."
  109. DISPLAYLN " Maximum of 10 filenames can be entered."
  110. DISPLAY   " A blank entry starts the transfers."
  111.  
  112. ;---------------------------------------------------------;
  113. ;  Prompt for the Transfer protocol to use                ;
  114. ;---------------------------------------------------------;
  115. COLOR     12                  ; set a pleasing color
  116. BOX       53 10 80 24         ; draw a box
  117. COLOR     2                   ; select green
  118. CLRSCR                        ; clear the box
  119. DISPLAY   "Protocol > "       ; ask for the protocol
  120. COLOR     3                   ; display response in cyan
  121. GET       0 12                ; get the response in $0
  122. IF        "$0" = ""  DONE     ; was ENTER alone pressed? goto DONE if so
  123. ASSIGN    XFER $0             ; nope, so store in $XFER for later
  124.  
  125. ;---------------------------------------------------------;
  126. ;  Loop up to 10 times to read the filenames to download  ;
  127. ;---------------------------------------------------------;
  128. ASSIGN    FNUM  0             ; reset a loop counter
  129. LOOP1:                        ; loop1 position
  130. GOSUB     GETFILENAME         ; call the GetFileName subroutine
  131. IF        "$RC" = "0" GO      ; was it successfull?  No, then goto GO
  132. INCR      FNUM                ; Increment the loop counter
  133. IF        "$FNUM" >= "10" GO  ; greater than or equal to 10?  If so, goto GO
  134. GOTO      LOOP1               ; nope, branch back to LOOP1
  135.  
  136.  
  137. ;---------------------------------------------------------;
  138. ;  Start the transfer of the selected files               ;
  139. ;---------------------------------------------------------;
  140. GO:
  141. IF        "$0" = ""  DONE         ; if none entered, go to cleanup routine
  142. WINDOW    1,1,80,14               ; setup the upper window
  143. COLOR     2
  144. CLRSCR
  145. GOTOXY    1,14
  146. DISPLAY   "═══════════════════════════════════════"
  147. DISPLAY   "═══════════════════════════════════════"
  148.  
  149. GOTOXY    26,1                    ; put the headings on the screen
  150. COLOR     15
  151. DISPLAYLN "File Transfer Status Window"
  152. COLOR     14
  153. DISPLAYLN " Number       Filename         Status"
  154. COLOR     7
  155.  
  156.  
  157. ;---------------------------------------------------------;
  158. ;  Go through all 10 entries and display their status     ;
  159. ;---------------------------------------------------------;
  160. DISPLAY   "   1          $0"
  161. GOTOXY    32,3
  162. DISPLAYLN "In Queue"
  163.  
  164. IF        "$1" = "" CONT1
  165. DISPLAY   "   2          $1"
  166. GOTOXY    32,4
  167. DISPLAYLN "In Queue"
  168.  
  169. IF        "$2" = "" CONT1
  170. DISPLAY   "   3          $2"
  171. GOTOXY    32,5
  172. DISPLAYLN "In Queue"
  173.  
  174. IF        "$3" = "" CONT1
  175. DISPLAY   "   4          $3"
  176. GOTOXY    32,6
  177. DISPLAYLN "In Queue"
  178.  
  179. IF        "$4" = "" CONT1
  180. DISPLAY   "   5          $4"
  181. GOTOXY    32,7
  182. DISPLAYLN "In Queue"
  183.  
  184. IF        "$5" = "" CONT1
  185. DISPLAY   "   6          $5"
  186. GOTOXY    32,8
  187. DISPLAYLN "In Queue"
  188.  
  189. IF        "$6" = "" CONT1
  190. DISPLAY   "   7          $6"
  191. GOTOXY    32,9
  192. DISPLAYLN "In Queue"
  193.  
  194. IF        "$7" = "" CONT1
  195. DISPLAY   "   8          $7"
  196. GOTOXY    32,10
  197. DISPLAYLN "In Queue"
  198.  
  199. IF        "$8" = "" CONT1
  200. DISPLAY   "   9          $8"
  201. GOTOXY    32,11
  202. DISPLAYLN "In Queue"
  203.  
  204. IF        "$9" = "" CONT1
  205. DISPLAY   "   10         $9"
  206. GOTOXY    32,12
  207. DISPLAYLN "In Queue"
  208.  
  209.  
  210. ;---------------------------------------------------------;
  211. ;  Ok, now, set up the lower window where we can watch    ;
  212. ;  The BBS as the files are transfered!                   ;
  213. ;---------------------------------------------------------;
  214. CONT1:
  215. GOSUB     Set_Bottom
  216. CLRSCR
  217. COLOR     15
  218.  
  219. Timeout   30 DONE
  220. GOSUB     Set_Top
  221. GOTOXY    32,3
  222. COLOR     142
  223. DISPLAY   "ACTIVE              "
  224.  
  225. ;---------------------------------------------------------;
  226. ;  DO File #1                                             ;
  227. ;---------------------------------------------------------;
  228. t0:
  229. GOSUB     Set_Bottom
  230. SEND      "^M"
  231. IF        "$0" = "" DONE
  232. WAITFOR   "Command?"
  233. SEND      "d $0 $XFER^M"
  234. WAITFOR   " Aborts Transfer"
  235. DELAY     3000
  236. DOWNLD    $XFER $DLPATH$0
  237. IF        $SUCCESS s0
  238. GOSUB     Set_Top
  239. GOTOXY    32,3
  240. COLOR     12
  241. DISPLAY   "* Error - retrying *"
  242. GOTO      t0:
  243.  
  244. s0:
  245. GOSUB     Set_Top
  246. GOTOXY    32,3
  247. COLOR     10
  248. DISPLAY   "* Complete *        "
  249. IF        "$1" = "" DONE
  250. GOTOXY    32,4
  251. COLOR     142
  252. DISPLAY   "ACTIVE              "
  253.  
  254. ;---------------------------------------------------------;
  255. ;  DO File #2                                             ;
  256. ;---------------------------------------------------------;
  257. t1:
  258. GOSUB     Set_Bottom
  259. SEND      "^M"
  260. WAITFOR   "Command?"
  261. SEND      "d $1 $XFER^M"
  262. WAITFOR   " Aborts Transfer"
  263. DELAY     3000
  264. DOWNLD    $XFER $DLPATH$1
  265. IF        $SUCCESS s1
  266. GOSUB     Set_Top
  267. GOTOXY    32,4
  268. COLOR     12
  269. DISPLAY   "* Error - retrying *"
  270. GOTO      t1:
  271.  
  272. s1:
  273. GOSUB     Set_Top
  274. GOTOXY    32,4
  275. COLOR     10
  276. DISPLAY   "* Complete *        "
  277. IF        "$2" = "" DONE
  278. GOTOXY    32,5
  279. COLOR     142
  280. DISPLAY   "ACTIVE              "
  281.  
  282.  
  283. ;---------------------------------------------------------;
  284. ;  DO File #3                                             ;
  285. ;---------------------------------------------------------;
  286. t2:
  287. GOSUB     Set_Bottom
  288. SEND      "^M"
  289. WAITFOR   "Command?"
  290. SEND      "d $2 $XFER^M"
  291. WAITFOR   " Aborts Transfer"
  292. DELAY     3000
  293. DOWNLD    $XFER $DLPATH$2
  294. IF        $SUCCESS s2
  295. GOSUB     Set_Top
  296. GOTOXY    32,5
  297. COLOR     12
  298. DISPLAY   "* Error - retrying *"
  299. GOTO      t2:
  300.  
  301. s2:
  302. GOSUB     Set_Top
  303. GOTOXY    32,5
  304. COLOR     10
  305. DISPLAY   "* Complete *        "
  306. IF        "$3" = "" DONE
  307. GOTOXY    32,6
  308. COLOR     142
  309. DISPLAY   "ACTIVE              "
  310.  
  311.  
  312. ;---------------------------------------------------------;
  313. ;  DO File #4                                             ;
  314. ;---------------------------------------------------------;
  315. t3:
  316. GOSUB     Set_Bottom
  317. SEND      "^M"
  318. WAITFOR   "Command?"
  319. SEND      "d $3 $XFER^M"
  320. WAITFOR   " Aborts Transfer"
  321. DELAY     3000
  322. DOWNLD    $XFER $DLPATH$3
  323. IF        $SUCCESS s3
  324. GOSUB     Set_Top
  325. GOTOXY    32,6
  326. COLOR     12
  327. DISPLAY   "* Error - retrying *"
  328. GOTO      t3:
  329.  
  330. s3:
  331. GOSUB     Set_Top
  332. GOTOXY    32,6
  333. COLOR     10
  334. DISPLAY   "* Complete *        "
  335. IF        "$4" = "" DONE
  336. GOTOXY    32,7
  337. COLOR     142
  338. DISPLAY   "ACTIVE              "
  339.  
  340.  
  341. ;---------------------------------------------------------;
  342. ;  DO File #5                                             ;
  343. ;---------------------------------------------------------;
  344. t4:
  345. GOSUB     Set_Bottom
  346. SEND      "^M"
  347. WAITFOR   "Command?"
  348. SEND      "d $4 $XFER^M"
  349. WAITFOR   " Aborts Transfer"
  350. DELAY     3000
  351. DOWNLD    $XFER $DLPATH$4
  352. IF        $SUCCESS s4
  353. GOSUB     Set_Top
  354. GOTOXY    32,7
  355. COLOR     12
  356. DISPLAY   "* Error - retrying *"
  357. GOTO      t4:
  358.  
  359. s4:
  360. GOSUB     Set_Top
  361. GOTOXY    32,7
  362. COLOR     10
  363. DISPLAY   "* Complete *        "
  364. IF        "$5" = "" DONE
  365. GOTOXY    32,8
  366. COLOR     142
  367. DISPLAY   "ACTIVE              "
  368.  
  369.  
  370. ;---------------------------------------------------------;
  371. ;  DO File #6                                             ;
  372. ;---------------------------------------------------------;
  373. t5:
  374. GOSUB     Set_Bottom
  375. SEND      "^M"
  376. WAITFOR   "Command?"
  377. SEND      "d $5 $XFER^M"
  378. WAITFOR   " Aborts Transfer"
  379. DELAY     3000
  380. DOWNLD    $XFER $DLPATH$5
  381. IF        $SUCCESS s5
  382. GOSUB     Set_Top
  383. GOTOXY    32,8
  384. COLOR     12
  385. DISPLAY   "* Error - retrying *"
  386. GOTO      t5:
  387.  
  388. s5:
  389. GOSUB     Set_Top
  390. GOTOXY    32,8
  391. COLOR     10
  392. DISPLAY   "* Complete *        "
  393. IF        "$6" = "" DONE
  394. GOTOXY    32,9
  395. COLOR     142
  396. DISPLAY   "ACTIVE              "
  397.  
  398.  
  399. ;---------------------------------------------------------;
  400. ;  DO File #7                                             ;
  401. ;---------------------------------------------------------;
  402. t6:
  403. GOSUB     Set_Bottom
  404. SEND      "^M"
  405. WAITFOR   "Command?"
  406. SEND      "d $6 $XFER^M"
  407. WAITFOR   " Aborts Transfer"
  408. DELAY     3000
  409. DOWNLD    $XFER $DLPATH$6
  410. IF        $SUCCESS s6
  411. GOSUB     Set_Top
  412. GOTOXY    32,9
  413. COLOR     12
  414. DISPLAY   "* Error - retrying *"
  415. GOTO      t6:
  416.  
  417. s6:
  418. GOSUB     Set_Top
  419. GOTOXY    32,9
  420. COLOR     10
  421. DISPLAY   "* Complete *        "
  422. IF        "$7" = "" DONE
  423. GOTOXY    32,10
  424. COLOR     142
  425. DISPLAY   "ACTIVE              "
  426.  
  427.  
  428. ;---------------------------------------------------------;
  429. ;  DO File #8                                             ;
  430. ;---------------------------------------------------------;
  431. t7:
  432. GOSUB     Set_Bottom
  433. SEND      "^M"
  434. WAITFOR   "Command?"
  435. SEND      "d $7 $XFER^M"
  436. WAITFOR   " Aborts Transfer"
  437. DELAY     3000
  438. DOWNLD    $XFER $DLPATH$7
  439. IF        $SUCCESS s7
  440. GOSUB     Set_Top
  441. GOTOXY    32,10
  442. COLOR     12
  443. DISPLAY   "* Error - retrying *"
  444. GOTO      t7:
  445.  
  446. s7:
  447. GOSUB     Set_Top
  448. GOTOXY    32,10
  449. COLOR     10
  450. DISPLAY   "* Complete *        "
  451. IF        "$8" = "" DONE
  452. GOTOXY    32,11
  453. COLOR     142
  454. DISPLAY   "ACTIVE              "
  455.  
  456.  
  457. ;---------------------------------------------------------;
  458. ;  DO File #9                                             ;
  459. ;---------------------------------------------------------;
  460. t8:
  461. GOSUB     Set_Bottom
  462. SEND      "^M"
  463. WAITFOR   "Command?"
  464. SEND      "d $8 $XFER^M"
  465. WAITFOR   " Aborts Transfer"
  466. DELAY     3000
  467. DOWNLD    $XFER $DLPATH$8
  468. IF        $SUCCESS s8
  469. GOSUB     Set_Top
  470. GOTOXY    32,11
  471. COLOR     12
  472. DISPLAY   "* Error - retrying *"
  473. GOTO      t8:
  474.  
  475. s8:
  476. GOSUB     Set_Top
  477. GOTOXY    32,11
  478. COLOR     10
  479. DISPLAY   "* Complete *        "
  480. IF        "$9" = "" DONE
  481. GOTOXY    32,12
  482. COLOR     142
  483. DISPLAY   "ACTIVE              "
  484.  
  485.  
  486. ;---------------------------------------------------------;
  487. ;  DO File #10                                            ;
  488. ;---------------------------------------------------------;
  489. t9:
  490. GOSUB     Set_Bottom
  491. SEND      "^M"
  492. WAITFOR   "Command?"
  493. SEND      "d $9 $XFER^M"
  494. WAITFOR   " Aborts Transfer"
  495. DELAY     3000
  496. DOWNLD    $XFER $DLPATH$9
  497. IF        $SUCCESS s9
  498. COLOR     12
  499. GOSUB     Set_Top
  500. GOTOXY    32,12
  501. DISPLAY   "* Error - retrying *"
  502. GOTO      t9:
  503.  
  504. s9:
  505. GOSUB     Set_Top
  506. GOTOXY    32,12
  507. COLOR     10
  508. DISPLAY   "* Complete *        "
  509.  
  510.  
  511.  
  512. ;---------------------------------------------------------;
  513. ;  The Cleanup code                                       ;
  514. ;---------------------------------------------------------;
  515. DONE:
  516. DISPLAYLN " "
  517. COLOR     11
  518. DISPLAY   "              Press ENTER to Continue "
  519. GET       1 1
  520. PUTSCR
  521. COLOR     $SATTR
  522. EXIT
  523.